import req from './RequestUtil'
// 社区
export const findCommunity = param => {
  let path = '/community'
  return req.get(path, param)
}

export const createCommunity = data => {
  let path = '/community/'
  return req.post(path, data)
}

export const updateCommunity = data => {
  let path = '/community/' + data.id
  return req.put(path, data)
}

export const deleteCommunity = data => {
  let path = '/community/' + data.id
  return req.delete(path, data)
}

export const findCommunityList = param => {
  let path = '/community/list'
  return req.get(path, param)
}

// 楼栋
export const findBuilding = param => {
  let path = '/building'
  return req.get(path, param)
}

export const createBuilding = data => {
  let path = '/building/'
  return req.post(path, data)
}

export const updateBuilding = data => {
  let path = '/building/' + data.id
  return req.put(path, data)
}

export const deleteBuilding = data => {
  let path = '/building/' + data.id
  return req.delete(path, data)
}

export const findBuildingList = param => {
  let path = '/building/list'
  return req.get(path, param)
}

export const getBuilding = id => {
  let path = '/building/' + id
  return req.get(path)
}

// 单元
export const findUnit = param => {
  let path = '/unit'
  return req.get(path, param)
}

export const createUnit = data => {
  let path = '/unit/'
  return req.post(path, data)
}

export const updateUnit = data => {
  let path = '/unit/' + data.id
  return req.put(path, data)
}

export const findUnitList = param => {
  let path = '/unit/list'
  return req.get(path, param)
}

// 房屋
export const findHouse = param => {
  let path = '/house'
  return req.get(path, param)
}

export const createHouse = data => {
  let path = '/house/'
  return req.post(path, data)
}

export const updateHouse = data => {
  let path = '/house/' + data.id
  return req.put(path, data)
}

export const deleteHouse = data => {
  let path = '/house/' + data.id
  return req.delete(path)
}

export const getHouse = id => {
  let path = '/house/' + id
  return req.get(path)
}

export const findHouseList = param => {
  let path = '/house/list'
  return req.get(path, param)
}

// 出租房
export const findRentalHouse = param => {
  let path = '/rentalHouse'
  return req.get(path, param)
}

export const createRentalHouse = data => {
  let path = '/rentalHouse/'
  return req.post(path, data)
}

export const updateRentalHouse = data => {
  let path = '/rentalHouse/' + data.id
  return req.put(path, data)
}

export const deleteRentalHouse = data => {
  let path = '/rentalHouse/' + data.id
  return req.delete(path)
}

export const getRentalHouse = id => {
  let path = '/rentalHouse/' + id
  return req.get(path)
}

// 院落
export const findCourtyard = param => {
  let path = '/courtyard'
  return req.get(path, param)
}

export const createCourtyard = data => {
  let path = '/courtyard/'
  return req.post(path, data)
}

export const updateCourtyard = data => {
  let path = '/courtyard/' + data.id
  return req.put(path, data)
}

export const deleteCourtyard = data => {
  let path = '/courtyard/' + data.id
  return req.delete(path, data)
}

export const findCourtyardList = param => {
  let path = '/courtyard/list'
  return req.get(path, param)
}
export const getCourtyard = id => {
  let path = '/courtyard/' + id
  return req.get(path)
}

// 网格树
const GRID_TREE_PATH = '/grids/tree'
export const findGridTree = param => {
  return req.get(GRID_TREE_PATH, param)
}
export const allDict = keyName => {
  let DICT_KEY_LIST_PATH = '/gbDictionary/value/list?keyName=' + keyName
  return req.get(DICT_KEY_LIST_PATH)
}
// 部门树
const DEPT_TREE_PATH = '/depts/tree'
export const getDeptTree = param => {
  return req.get(DEPT_TREE_PATH, param)
}

// 社会组织
// 修改
export const updateSocialOrg = data => {
  let path = '/socialOrg/' + data.id
  return req.put(path, data)
}
// 删除
export const delSocialOrg = data => {
  let path = '/socialOrg/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const getSocialOrg = param => {
  let path = '/socialOrg'
  return req.get(path, param)
}
// 新增
export const createSocialOrg = data => {
  let path = '/socialOrg/'
  return req.post(path, data)
}

// 非公有制经济组织
// 修改
export const updateNonPublicOrg = data => {
  let path = '/nonPublicOrg/' + data.id
  return req.put(path, data)
}
// 删除
export const delNonPublicOrg = data => {
  let path = '/nonPublicOrg/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const getNonPublicOrg = param => {
  let path = '/nonPublicOrg'
  return req.get(path, param)
}
// 新增
export const createNonPublicOrg = data => {
  let path = '/nonPublicOrg/'
  return req.post(path, data)
}

// 留守人口
// 修改
export const updateLeftBehindPopulation = data => {
  let path = '/leftBehindPopulation/' + data.id
  return req.put(path, data)
}
// 删除
export const delLeftBehindPopulation = data => {
  let path = '/leftBehindPopulation/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const findLeftBehindPopulation = param => {
  let path = '/leftBehindPopulation'
  return req.get(path, param)
}
// 新增
export const createLeftBehindPopulation = data => {
  let path = '/leftBehindPopulation/'
  return req.post(path, data)
}
// 查看
export const getDetailLeftBehindPopulation = id => {
  let path = '/leftBehindPopulation/' + id
  return req.get(path)
}

// 户籍人口
// 修改
export const updateHouseholdPopulation = data => {
  let path = '/householdPopulation/' + data.id
  return req.put(path, data)
}
// 删除
export const delHouseholdPopulation = data => {
  let path = '/householdPopulation/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const findHouseholdPopulation = param => {
  let path = '/householdPopulation'
  return req.get(path, param)
}
// 新增
export const createHouseholdPopulation = data => {
  let path = '/householdPopulation/'
  return req.post(path, data)
}
// 查看
export const getDetailHouseholdPopulation = id => {
  let path = '/householdPopulation/' + id
  return req.get(path)
}

// 流动人口
// 修改
export const updateMobilePopulation = data => {
  let path = '/mobilePopulation/' + data.id
  return req.put(path, data)
}
// 删除
export const delMobilePopulation = data => {
  let path = '/mobilePopulation/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const getMobilePopulation = param => {
  let path = '/mobilePopulation'
  return req.get(path, param)
}
// 新增
export const createMobilePopulation = data => {
  let path = '/mobilePopulation/'
  return req.post(path, data)
}
// 查看
export const getDetailMobilePopulation = id => {
  let path = '/mobilePopulation/' + id
  return req.get(path)
}

// 防溺管理水域信息
// 修改
export const updateWater = data => {
  let path = '/water/' + data.id
  return req.put(path, data)
}
// 删除
export const delWater = data => {
  let path = '/water/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const findWater = param => {
  let path = '/water'
  return req.get(path, param)
}
// 新增
export const createWater = data => {
  let path = '/water/'
  return req.post(path, data)
}
// 详情
export const getWater = id => {
  let path = '/water/' + id
  return req.get(path)
}

// 部件管理
// 修改
export const updateComponent = data => {
  let path = '/component/' + data.id
  return req.put(path, data)
}
// 删除
export const delComponent = data => {
  let path = '/component/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const findComponent = param => {
  let path = '/component'
  return req.get(path, param)
}
// 新增
export const createComponent = data => {
  let path = '/component/'
  return req.post(path, data)
}

// 通知详情
export const getNoticeDetail = id => {
  let path = '/notice/' + id
  return req.get(path)
}
// 民情日志
export const getFolkLog = id => {
  let path = '/folkLog/' + id
  return req.get(path)
}

// 矛盾调解详情
export const getContrad = id => {
  let path = '/contradictoryAdjustment/' + id
  return req.get(path)
}
// 新增矛盾调解
export const createContradictoryAdjustment = data => {
  let path = '/contradictoryAdjustment/'
  return req.post(path, data)
}

// 事件详情

// 获取事件流程
export const getHistoricEvent = id => {
  let path = '/event/trace/history/' + id
  return req.get(path)
}
// 根据id查询当前事件详情
export const findEventDetail = id => {
  let path = '/event/' + id
  return req.get(path)
}

export const finishTasks = data => {
  let path = data.isWorkflow ?  '/event/runtime/task/' + data.taskId : '/event/' + data.businessId
  return req.put(path, data)
}

//本地图片
export const getImageUrl = data => {
  let path = '/image/'
  return req.post(path, data)
}
// 上传音频
export const getSoundUrl = data => {
  let path =  '/file/'
  return req.post(path, data)
}
//地图经纬度
export const getMapLocationByTarget = data => {
  let path = `/mapLocation/${data.targetType}/${data.targetId}`
  return req.get(path)
}

export const getMapLocationByTargetList = data => {
  let path = `/mapLocation/grid/${data.targetType}`
  return req.get(path)
}
export const createMapLocation = data => {
  let path = '/mapLocation/'
  return req.post(path, data)
}